﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace MrPoetic.MatLab.Algebra
{
    // 参数枚举: 排列组合 
    public enum CombinationType
    {
        Arrangement, Combination,
    }

    /// <summary>
    /// 主要用于实现人类代数中较为`精妙`和`实用`的算法
    /// Named: European欧洲人 希望自己运气好一点
    /// </summary>
    public class European
    {
        /// <summary>
        /// 排列组合函数 A2 = 30,C42 = 6
        /// </summary>
        /// <param name="baseNum">底数</param>
        /// <param name="Number">N M选N</param>
        /// <returns></returns>
        static public int Combinate(int baseNum, int Number, CombinationType type)
        {
            int rs = 1;
            for (int x = 1; x <= Number; x++)
                rs *= baseNum--;
            switch (type)
            {
                case CombinationType.Arrangement:
                    break;
                case CombinationType.Combination:
                    for (int x = 1; x <= Number; x++)
                        rs /= x;
                    break;
            }
            return rs;
        }
        /// <summary>
        /// 选出一些特殊的关键电荷位质数
        /// </summary>
        /// <param name="primes"></param>
        /// <returns></returns>
        static public IEnumerable<long> PickWithPrimes(int Counts)
        {
            int uprDouble = Counts * Counts;
            var left = DataMatrix.PrimesIMPL(uprDouble).Take(Counts);
            return left;
        }

        static public IEnumerable<long> ConstPrimes()
        {
            return new long[] { 2,7,13,19,29,41,};
        }
    }
}
